{include file="public/header" /}
<link rel="stylesheet" href="/static/index/css/draw.css">
<body class="hide-top bgc">
<div class="draw-container">
    <img src="/static/index/img/icon36.png" alt="">
    <div class="draw-content">
        <div class="earnings-content">
            <div class="earnings-hd flex-center">
                <i class="layui-icon layui-icon-left flex-center" onclick="history.go(-1)"></i>优惠券互转
                <div  class="record" onclick="load_href('{:url(\'transfer/record\')}',2)">
                    转账记录
                </div>
            </div>
        </div>
        <div class="draw-account">
            <div>
                <p class="price">优惠券</p>
                <p class="num">￥<span>{$user.assets.electronic}</span></p>
            </div>
        </div>
        <form action="{:url('transfer/save')}" method="post" class="form layui-form">
            <div class="draw-account-news">
                <p class="title">转账金额</p>
                <div class="draw-price">￥
                    <input type="text" lay-verify="required" lay-reqtext="请填写转账金额" lay-verType="tips"
                           name="amount" id="money" placeholder="请填写转账金额" autocomplete="off"
                           onkeyup="value=value.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')">
                    <p class="all">全部</p>
                </div>
                <div class="flex-layout">转账账户
                    <select name="account" id="account">
                        <option value="electronic">优惠券</option>
                    </select>
                </div>
                <div class="flex-layout">收账会员手机号
                    <input type="text" type="text" lay-verify="required" lay-reqtext="请填写收账会员手机号"
                           lay-verType="tips"
                           name="take" id="take" placeholder="请填写收账会员手机号"  style="text-align: right">
                </div>
                <div class="flex-layout take_info" style="display: none">收账会员姓名
                    <input type="text" readonly value="" class="take_nickname" style="text-align: right">
                </div>
                <div class="flex-layout">支付密码
                    <input type="password" lay-verify="required" lay-reqtext="请输入支付密码" lay-verType="tips"
                           name="pay_password" placeholder="请输入支付密码" style="text-align: right">
                </div>
            </div>
            <p class="save upd-save" lay-submit lay-filter="save" formObj=".form">确认</p>
        </form>

    </div>
</div>
</body>

{include file="public/footer"/}
<script>
    $('#take').blur(function () {
        var value = $(this).val();
        if (value) {
            $.ajax({
                type: 'GET',
                url: '{:url("transfer/verify")}',
                data: {code: value},
                dataType: "json",
                success: function (data) {
                    if (data.code === 1) {
                        $(".take_nickname").val(data.data).css('color', '#008200');
                    } else {
                        $(".take_nickname").val(data.data).css('color', 'red');
                    }
                    $(".take_info").show();
                }
            });
        } else {
            $(".take_info").hide();
        }
    });
</script>
</html>